package study.cell_game.enums;

public enum Direction {
	NORTH(0),
	NORTHEAST(1),
	NORTHWEST(2),
	SOUTHEAST(3),
	SOUTHWEST(4),
	SOUTH(5);
	
	private static final int max = 5;
	
	private int numVal;
	
	private Direction(int numVal){
		this.numVal = numVal;
	}
	
	public int getValue(){
		return numVal;
	}
	
	public static Direction opposite(Direction dir){
		return Direction.values()[max - dir.numVal];
	}
	
	public Direction opposite(){
		return Direction.values()[max - this.numVal];
	}

	public static Direction fromInt(int val) {
		return Direction.values()[val];
	}
}
